########################################################### # Этот файл обеспечивает стандартный интерфейс AVISynth к # # различным плагинам VirtualDub. Его можно загрузить в # # свой скрипт командой: # # # # Import("vdfilters.avs") # ########################################################### ######################################################### # Измените VirtualDub_plugin_directory ниже на истинный # # путь к директории содержащей ваши плагины VirtualDub # ######################################################### global VirtualDub_plugin_directory = "d:\virtualdub\plugins" ############################## # 2D Cleaner by Jim Casaburi # ############################## function VD_2DCleaner(clip clip, int "threshold", int "radius", bool "interlaced") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\2dclean.vdf", "_VD_2DCleaner") return clip._VD_2DCleaner(default(interlaced,false)?1:0, threshold, radius) } #################################### # Temporal Cleaner by Jim Casaburi # #################################### function VD_TemporalCleaner(clip clip, int "threshold", int "pixel_lock", \ int "threshold2", int "pixel_lock2", int "scene", \ bool "partial", bool "yuv") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\tclean.vdf", "_VD_TemporalCleaner", 10) return clip._VD_TemporalCleaner(default(threshold,10), default(pixel_lock,4), \ default(threshold2,16), default(pixel_lock2,8), default(scene,30), \ default(partial,false)?1:0, default(yuv,true)?1:0) } ############################ # Colorize by Donald Graft # ############################ function VD_Colorize(clip clip, int "hue", int "sat", int "lum") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\colorize.vdf", "_VD_Colorize") return clip._VD_Colorize(default(hue, 0), default(sat, 150), default(lum, 150)) } ############################# # Deflicker by Donald Graft # ############################# # Двух-проходный фильтр, не поддерживается. # Возможно будет переписан как фильтр AVISynth ############################################ # Hue/Saturation/Intensity by Donald Graft # ############################################ function DG_FloatToInt(f) { return round((default(f,1.0) - 1) * 100) } function VD_Hue(clip clip, int "hue", bool "preserve_luma", float "sat", float "inten", \ bool "r", bool "g", bool "b", bool "y", bool "c", bool "m") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\hue.vdf", "_VD_Hue") hue = default(hue, 0) sat = DG_FloatToInt(sat) inten = DG_FloatToInt(inten) flags = (default(r,true)?1:0)+(default(g,true)?2:0)+(default(b,true)?4:0) \ +(default(y,true)?8:0)+(default(c,true)?16:0)+(default(m,true)?32:0) return clip._VD_Hue(hue, default(preserve_luma,false)?1:0, sat, inten, flags) } ############################################# # Red/Green/Blue Adjustment by Donald Graft # ############################################# function VD_RGBAdjustment(clip clip, float "r", float "g", float "b") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\rgb.vdf", "_VD_RGBAdjustment") return clip._VD_RGBAdjustment(DG_FloatToInt(r), DG_FloatToInt(g), DG_FloatToInt(b)) } ############################# # Smart Bob by Donald Graft # ############################# # входной клип должен пройти через SeparateFields. Возможно вам # понадобится AssumeFrameBased, AssumeFieldBased, или ComplementParity # перед ним. function VD_SmartBob(clip clip, bool "show_motion", int "threshold", bool "motion_map_denoising") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\bob.vdf", "_VD_SmartBob", 1) return clip.SeparateFields._VD_SmartBob(clip.GetParity()?1:0, \ default(show_motion,false)?1:0, default(threshold,10), \ default(motion_map_denoising,true)?1:0) } ######################## # Logo by Donald Graft # ######################## function VD_Logo(clip clip, int "x", int "y", int "alpha", bool "transparent", \ int "xr", int "xg", int "xb", string "filename", \ bool "animate", int "start", int "duration", int "loops") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\logo.vdf", "_VD_Logo", 1) return clip._VD_Logo(default(x,0), default(y,0), default(alpha,128), \ default(transparent,true)?1:0, default(xr,0), default(xg,0), default(xb,255), \ default(filename,"d:\virtualdub\plugins\logo.bmp"), \ default(animate,false)?1:0, default(start,0), default(duration,0), default(loops,0)) } ##################################### # Smart Deinterlace by Donald Graft # ##################################### # "Advanced Processing" опция не включена, так-как # в ней дублируется встроеная функциональность AVISynth function VD_SmartDeinterlace(clip clip, string "mode", string "channel", bool "show_motion", \ bool "blend", bool "motion_map_denoising", int "threshold") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\smart.vdf", "_VD_SmartDeinterlace", 1) mode = default(mode, "frame") mode = (mode=="frame") ? 0 : (mode=="field") ? 1 : (mode=="both") ? 2 : -1 Assert(mode>=0, """VD_SmartDeinterlace: "mode" parameter must be "frame", "field", or "both"""") channel = default(channel, "luma") channel = (channel=="luma") ? 0 : (channel=="all") ? 1 : -1 Assert(channel>=0, """VD_SmartDeinterlace: "channel" parameter must be "luma" or "all"""") return clip._VD_SmartDeinterlace(default(show_motion,false)?1:0, \ default(blend,false)?1:0, default(threshold,20), 0, 0, 0, \ default(motion_map_denoising,true)?1:0, mode, channel) } ################################## # Smart Smoother by Donald Graft # ################################## function VD_SmartSmoother(clip clip, int "diameter", int "threshold", bool "interlaced") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\smooth.vdf", "_VD_SmartSmoother", 1) return clip._VD_SmartSmoother(default(diameter,5), default(threshold,25), \ default(interlaced,false)?1:0) } ################################ # Unsharp Mask by Donald Graft # ################################ function VD_UnsharpMask(clip clip, int "diameter", int "strength", int "threshold", \ bool "interlaced", int "mask_top", int "mask_bottom", \ int "mask_left", int "mask_right") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\unsharp.vdf", "_VD_UnsharpMask", 1) return clip._VD_UnsharpMask(default(diameter,5), default(strength,32), \ default(threshold,0), default(mask_left,0), default(mask_right,0), \ default(mask_bottom,0), default(mask_top,0), default(interlaced,false)?1:0) } ########################## # Subtitler by Avery Lee # ########################## # не-сглаженный режим не поддерживаентся, так-как # эмулятор VirtualDub не поддерживает NEEDS_HDC function VD_Subtitler(clip clip, string filename) { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\subtitler.vdf", "_VD_Subtitler") return clip._VD_Subtitler(1, filename) } ################################# # Border Smear by Simon Walters # ################################# function VD_BorderSmear(clip clip, int yt, int yb) { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\brdrsmr.vdf", "_VD_BorderSmear") return clip._VD_BorderSmear(yt, yb) } ################################ # Logoaway by Krzysztof Wojdon # ################################ function VD_LogoAway(clip clip, string "mode", int "x", int "y", int "width", \ int "height", int "keyframe", int "color") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\logoaway.vdf", "_VD_LogoAway") mode = default(mode, "xblur") mode = (mode=="xblur")?1:(mode=="yblur")?2:(mode=="xyblur")?3:(mode=="copy")?4: \ (mode=="avgborder")?5:(mode=="solid")?6:0 Assert(mode>0, "VD_LogoAway: mode must be one of: xblur yblur xyblur copy avgborder solid") return clip._VD_LogoAway(mode, default(x,300), default(y,8), default(width,14), \ default(height,12), default(keyframe,0), default(color,0)) } ########################## # Cartoon Tool by flaXen # ########################## # "Show Inverse Map" не поддерживается, так-как очевидно # недоступен через интерфейс скрипта function VD_CartoonTool(clip clip, int "scale_base", int "scale_intensity", int "pixel_base") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\fxtoon.vdf", "_VD_CartoonTool") return clip._VD_CartoonTool(default(scale_base,16),default(scale_intensity,200),default(pixel_base,16)) } ######################## # VHS Filter by flaXen # ######################## function VD_VHS(clip clip, bool "stabilize", int "luma_threshold", int "chroma_threshold", \ int "temporal_error", int "temporal_bias", int "noise_threshold", \ int "pixel_radius", bool "prefilter", bool "postfilter", bool "sharpen", \ int "sharpen_amount", bool "eight_direction", int "chroma_shift_x", \ int "chroma_shift_y", bool "shift_i", bool "shift_q") { LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\fxvhs.vdf", "_VD_VHS") return clip._VD_VHS(default(stabilize,true)?1:0, default(luma_threshold,5), \ default(chroma_threshold,30), default(temporal_error,15), default(temporal_bias,5), \ default(noise_threshold,10), default(pixel_radius,1), default(prefilter,false)?1:0, \ default(postfilter,false)?1:0, default(sharpen,false)?1:0, default(sharpen_amount,15), \ default(eight_direction,false)?1:0, default(chroma_shift_x,-1), default(chroma_shift_y,0), \ default(shift_i,false)?1:0, default(shift_q,false)?1:0) }